//
// Created by francklinson on 2021/11/17 AT 23:27.
// May Saint Diana bless you!
//

#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <functional>
#include <climits>
#include <string>

using namespace std;

class Solution {
public:
    vector<int> selfDividingNumbers(int left, int right) {
        vector<int> ans;
        for (int i = left; i <= right; ++i) {
            if (check(i)) {
                ans.push_back(i);
            }
        }
        return ans;
    }

    // 判断一个数字是不是自除数
    bool check(int x) {
        int original = x;
        while (x) {
            int temp = x % 10;
            if (temp == 0)
                return false;
            if (original % temp)
                return false;
            x /= 10;
        }
        return true;
    }
};

int main() {
    Solution solution;
    vector<int> ans = solution.selfDividingNumbers(1, 22);
    for (const int &x: ans) cout << x << endl;
    return 0;
}

